var express = require('express');
var router = express.Router();
var {login}=require('../serve/login.js')
//登录验证接口
router.get('/', function (req, res, next) {
  res.json({
    stause:false,
    err:'请使用POST请求'
  })
});

router.post('/', function (req, res, next) {
  login(req.body).then(data => {
    res.cookie('token', data.token, { expires: new Date(Date.now() + 900000), httpOnly: false})
    res.json(data)
  })
})

module.exports = router;
